Add cursor agent support, reject unknown agents, fix ACP alias collision#409
Add cursor agent support, reject unknown agents, fix ACP alias collision#409bgoosmanviz wants to merge 6 commits intoroborev-dev:mainfrom
Conversation
roborev: Combined Review (
|
mariusvniekerk
left a comment
There was a problem hiding this comment.
Given how this issue arose we need more validation on the config /params for agents. Returning an error for an unknown explicitly asked for agent feels appropriate
GetAvailable() now returns an error for unrecognized agent names (typos like "claud") instead of silently falling back. Known-but- unavailable agents (binary not installed) still fall back as before. Fix isConfiguredACPAgentName() to use exact comparison instead of alias-resolved comparison, preventing the "agent" → "cursor" alias from incorrectly matching ACP config when acp.name = "agent". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…test Make TestGetAvailableFallsBackForKnownUnavailable deterministic by isolating the registry and PATH instead of relying on ambient state. Add TestACPNameDoesNotMatchCanonicalRequest to lock the contract that acp.name="claude" matches request "claude" but not "claude-code". Add clarifying comment to isConfiguredACPAgentName explaining exact match semantics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Append .exe on Windows so exec.LookPath resolves the stub binary via PATHEXT, matching the pattern used in other agent tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ffc4cc5 to
59dc306
Compare
Add UnknownAgentError typed error so callers can distinguish typos (bad request) from genuinely unavailable agents (service unavailable). Server enqueue and fix endpoints now return 400 with "invalid agent" for unknown names instead of 503 with "no review agent available". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
Add TestHandleFixJobAgentAvailability covering the 400/503 split in handleFixJob: unknown fix agent returns 400, no agents returns 503. Replace unnecessary fmt.Errorf().Error() with fmt.Sprintf in UnknownAgentError.Error() to avoid allocating a throwaway error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
GitHub is being cranky so opened #430 so I can get CI |
Summary
"agent"CLI binary and"agent" → "cursor"alias--agent claud) with a clear error listing known agents, instead of silently falling back to a different agentacp.name = "agent"would incorrectly intercept cursor requests via alias resolution —isConfiguredACPAgentNamenow uses exact matching on the raw (pre-alias) nameUnknownAgentErrorso HTTP handlers can distinguish the two casesTest plan
go test ./internal/agent/... -count=1— all passgo test ./internal/daemon/... -count=1— all passgo vet ./...— cleanTestGetAvailableRejectsUnknownAgent— typo returns errorTestGetAvailableFallsBackForKnownUnavailable— known agent falls back (deterministic)TestACPAliasCollisionFixed—acp.name="agent"+ request"cursor"→ real cursor agentTestACPNameDoesNotMatchCanonicalRequest—acp.name="claude"does not match"claude-code"TestHandleEnqueueAgentAvailability/unknown_agent_returns_400TestHandleFixJobAgentAvailability/unknown_fix_agent_returns_400TestHandleFixJobAgentAvailability/no_agents_available_returns_503🤖 Generated with Claude Code